<template>
	<view class="allComment">
		<view class="rate_item" v-for="(item, index) in commentObj.lists" :key="index"><EvaluationCom :itemData="item"></EvaluationCom></view>
		<u-loadmore :status="loadMoreStatus" v-if="commentObj.lists.length" />
	</view>
</template>

<script>
import com from '../../mixin/index.js';
import EvaluationCom from '../../components/EvaluationCom/EvaluationCom.vue';
export default {
	mixins: [com],
	components: {
		EvaluationCom
	},
	data() {
		return {
			page: {
				page: 1,
				page_size: 4
			},
			commentObj: {
				lists: [],
				total: 1,
				total_page: 0
			},
			product_id: '',
			tour_id: ''
		};
	},
	onLoad(val) {
		if (val.product_id) {
			this.product_id = val.product_id;
			let params = {
				...this.page,
				team_product_id: this.product_id
			};
			this.getList('commentObj', 'getShopComment', 'page', params);
		}
		if (val.tour_id) {
			this.tour_id = val.tour_id;
			let params = {
				...this.page,
				tour_id: this.tour_id
			};
			this.getList('commentObj', 'getTourComment', 'page', params);
		}
	},
	onReachBottom() {
		console.log('滚到底了');
		if (this.tour_id) {
			let params = {
				...this.page,
				tour_id: this.tour_id
			};
			this.getList('commentObj', 'getTourComment', 'page', params);
		}
		if (this.product_id) {
			let params = {
				...this.page,
				team_product_id: this.product_id
			};
			this.getList('commentObj', 'getShopComment', 'page', params);
		}
	},
	methods: {}
};
</script>

<style lang="scss">
.allComment {
	padding: 24rpx;
	background-color: #fff;
	.rate_item {
		margin-bottom: 40rpx;
	}
}
</style>
